import Mock from 'mockjs'
import { CONSTANT_OBJ } from '@/utils/constant'
let baseURL
let locationHref = `http://${window.location.hostname}`
if (CONSTANT_OBJ.ENV !== 'prodMaster') {
  baseURL = CONSTANT_OBJ.URL + CONSTANT_OBJ.PREFIX + '/user'
  // baseURL = URL
} else {
  baseURL = locationHref + CONSTANT_OBJ.PREFIX + '/user'
}
// 产品列表查询
Mock.mock(`${baseURL}/v1/api/pay/quota/draw/queryByCondition`, function () {
  return {
    ...CONSTANT_OBJ.MOCK_RESPONSE,
    data: {
      total: 1,
      list: [
        {
          caseId: '1', quotaDrawId: '1', loanSerialNo: '202206140707546', customerName: '小王王', productType: 101, loanAmount: 2000, loanPeriods: 12, feePayType: '等额本息', loanStatus: '主任审批中', acceptorName: 'wew', acceptorOrgName: 'ewewe', createTime: '2022-05-22 10:10:10', statusUpdateTime: '2022-08-19 15:40:10'
        }
      ]
    }
  }
})

// 通过ID查询额度支取详情
Mock.mock(`${baseURL}/v1/api/pay/quota/draw/queryById/1`, function () {
  return {
    ...CONSTANT_OBJ.MOCK_RESPONSE,
    data: {
      quotaDrawId: '1',
      loanSerialNo: '202206140707546',
      customerName: '小王王',
      productType: 101,
      loanAmount: 2000,
      loanPeriods: 12,
      loanRate: '8%',
      feePayType: '等额本息',
      loanStatus: '主任审批中',
      acceptorName: 'wew',
      acceptorOrgName: 'ewewe',
      createTime: '2022-05-22 10:10:10',
      statusUpdateTime: '2022-08-19 15:40:10'
    }
  }
})

// 通过caseId查询额度详情
Mock.mock(`${baseURL}/v1/api/case/case/basic/queryQuotaById/1`, function () {
  return {
    ...CONSTANT_OBJ.MOCK_RESPONSE,
    data: {
      totalQuota: '1000',
      remainQuota: 800,
      usedQuota: 200
    }
  }
})

// 提交审批
Mock.mock(`${baseURL}/v1/api/pay/quota/draw/audit/submit`, function () {
  return {
    ...CONSTANT_OBJ.MOCK_RESPONSE
  }
})
